﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="BaseData_ProductImg" Codebehind="ProductImg.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
<style type="text/css">
body{padding:0; margin:0; background-color:#ffffff; color:#000000; text-align:center; font: "宋体"; font-size:12px;}
.juli {margin-top:10px;padding-left:20px;}
h2 {padding-left:20px;padding-top:10px;margin:0; background: url(../Include/Images/menu_title.gif) repeat-x;height:21px;font-size:14px; font-weight:600; color:#000000;}
.z1{background-color:#e7e7e7; text-align:left; line-height:20px;}
.z2{background-color:#FFFFFF; text-align:left; line-height:20px;}
.input_button {width:52px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt.gif) no-repeat;}
.input_button1 {width:74px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt1.gif) no-repeat;}
.input_button2 {width:52px;height:23px;border:none;background:#ffffff url(../Include/Images/bt.gif) no-repeat; padding-top:5px;}
.input_button2 a{color:#000000;}
.input_button2 a:hover{color:#FF3300; text-decoration:underline;}
.input_button3 {width:95px;height:23px;border:none;background:#ffffff url(../Include/Images/bt2.gif) no-repeat;}
.input_button4 {width:143px;height:23px;border:none;background:#ffffff url(../Include/Images/bt3.gif) no-repeat;}
.zt1 {padding-left:10px; font-weight:600; color:#000000;}
.zt2 {padding-left:10px;}
.zt3 {text-align:center; font-weight:600; color:#000000;}
.zt4 {text-align:center; color:#000000;}
.menu_bg {background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 1px solid;}


</style>
    <script type="text/javascript">
    //document.oncontextmenu = function() { return false;} 
        function showImg(Timg,simg)
		{
			var reg1=/((jpg)|(gif))$/i;
			if(document.getElementById(Timg)&&document.getElementById(simg))
			{
			var Imgs=document.getElementById(Timg).value;
			if(!reg1.exec(Imgs)){alert("图片格式不正确!");document.getElementById(Timg).outerHTML=document.getElementById(Timg).outerHTML;return;}
			
			document.getElementById(simg).src=Imgs;
			}
			
		}
		function cc()
		{
		    window.opener=null;window.close();
		}
function Button3_onclick() {
var str = '<br><INPUT type="file"    runat="server" NAME="File">'
document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str)
}
function SetAddButton()
{//debugger;
    if(document.getElementById("CheckBox1").checked)
    {
        document.getElementById("Button3").style.display="none";
        document.getElementById("CheckBox2").checked=false;
    }
    else
    {
        document.getElementById("Button3").style.display="inline";
    }
}
function SetChkSelect(ctl)
{   
    if(ctl.checked == true)
    {
        var colorCode = "";
        var drop = document.getElementById("DropDownList1");
        for(var i=0;i<drop.options.length;i++)
        {
            if(drop.options[i].selected)
            {
                colorCode = drop.options[i].value;
                break;
            }
        }
        var arg = colorCode;
        <%= ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "")%>; 
    }
    
}
function ReceiveServerData(result)  
{
    if(result=="0")
    {
        alert("由于商品选择的颜色没有上传过非局部图片，因此需要先上传非局部图片！");
        document.getElementById("CheckBox2").checked = false;
        return;
    }
    else
    {
        if(document.getElementById("CheckBox2").checked)
        {
            document.getElementById("CheckBox1").checked=false;
            document.getElementById("Button3").style.display="inline";
        }
    }
}
//function Button4_onclick() {

//this.form.reset()
// 
////var rot=document.getElementById('MyFile') 
//// 
//// var i=rot.childNodes.length;
//// 
//// 
//// 
//// if(i==2){
////    alert('至少应该保留一个');
////    return;
//// }
//// 
//// rot.lastChild.re
//// rot.removeChild(rot.childNodes[i]);
////  rot.removeChild(rot.childNodes[i-1]);
//}

    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div align="Justify">
         <h2>上传商品图片</h2>
            <div class="menu_bg"><table width="100%" border="0"><br />
                <tr>
                    <td width="30%" align="left" valign="middle">
                        商品颜色:<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="ggmc" DataValueField="ggdm">
                        </asp:DropDownList><asp:CheckBox ID="CheckBox1" runat="server" Text="默认" /><asp:CheckBox ID="CheckBox2" runat="server" Text="局部" onclick="SetChkSelect(this);"/>
                    </td>
                    <td valign="top" align="left" rowspan="5">
                        <img id="imgss" src="" /></td>
                </tr>
                <tr>
                   <td align="left">&nbsp;</td>
                </tr>
                <tr>
                    <td align="left" valign="middle">
                    <p id="MyFile">
                        <input id="File1" type="file" runat="server" onchange="showImg('File1','imgss');" />
                        
                        </p>
                        </td>
                </tr>
                <tr>
                   <td align="left">&nbsp;</td>
                </tr>
                <tr>
                    <td align="left" valign="middle">
                        &nbsp;<input id="Button3" type="button" value="增 加" class="input_button" onclick="return Button3_onclick()" />
                       <%-- <input id="Button4" type="button" value="减 少" class="input_button" onclick="return Button4_onclick()" />--%>
                        <asp:Button ID="Button1" runat="server" CssClass="input_button" Text="上 传" OnClick="Button1_Click" />&nbsp;<asp:Button ID="Button2" runat="server" CssClass="input_button" Text="关 闭" OnClientClick="cc();return false;" />
                        <br />
                            </td>
                </tr>
            </table></div>
            &nbsp;
        </div>
    </form>
</body>
</html>
